<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>查询</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="Content-Type" content="multipart/form-data; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="../../../lib/layui-v2.5.5/css/layui.css" media="all">
		<link rel="stylesheet" href="../../../css/layuicmspublic.css" media="all">
		<link rel="stylesheet" href="../../../css/public.css" media="all">
		<link rel="stylesheet" href="../../../js/bootstrap/css/bootstrap.min.css" media="all">

		<!-- <link rel="stylesheet" type="text/css" href="https://raw.githack.com/hnzzmsf/layui-formSelects/master/dist/formSelects-v4.css" /> -->
	</head>

	<body>

		<!-- <div id="zzh"> -->
		<div class="layuimini-container">
			<div class="layuimini-main">
				<!--搜索开始-->
				<fieldset class="layui-elem-field layuimini-search">
					<legend>搜索信息</legend>
					<div style="margin: 10px 10px 10px 10px">
						<form class="layui-form layui-form-pane" action="" id="searchFrm">
							<div class="layui-form-item">
								<div class="layui-inline">
									<label class="layui-form-label">产品名称：</label>
									<div class="layui-input-inline">
										<input type="text" name="productName" autocomplete="off" class="layui-input">
									</div>
								</div>
							</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-block" style="text-align: center;">
							<a class="layui-btn " lay-submit="" lay-filter="data-search-btn"><label class="layui-icon layui-icon-search"></label>搜索</a>
							<a class="layui-btn layui-btn-warm" onclick="javascript:$('#searchFrm')[0].reset()" lay-filter="data-search-btn"><label
								 class="layui-icon layui-icon-refresh"></label>重置</a>
						</div>
					</div>
					</form>
			</div>
			</fieldset>
			<!--搜索结束-->

			<!--表格开始-->
			<!-- <table class="layui-hide" id="goodsTable" lay-filter="goodsTable"></table> -->


			<!--表格结束-->
			<div id="yby">
				<table class="layui-table">
					<thead>
						<tr style="background-color: #fff;">
							<th scope="col">工序设计单编号</th>
							<th scope="col">产品编号</th>
							<th scope="col">产品名称</th>
							<th scope="col">设计人</th>
							<th scope="col">登记人</th>
							<th scope="col">登记时间</th>
							<th scope="col">工序物料设计标志</th>
							<th scope="col">工时总成本</th>
							<th scope="col">制定</th>
						</tr>
					</thead>
					<tbody>
						<tr v-for="(item,index) in processOptions" :key="index">
							<td>{{item.designId}}</th>
							<td>{{item.productId}}</td>
							<td>{{item.productName}}</td>
							<td>{{item.designer}}</td>
							<td>{{item.register}}</td>
							<td>{{item.registerTime}}</td>
							<td>
								<span v-show="item.designModuleTag=='G002-1'">未设计</span>
								<span v-show="item.designModuleTag=='G002-2'">未审核</span>
								<span v-show="item.designModuleTag=='G002-3'">已审核</span>
							</td>
							<td>{{item.costPriceSum}}</td>
							<td>
								<button type="button" v-on:click="wllist(item)" class="btn btn-info operator" id="profile-tab" data-toggle="tab"
								 href="#edit" role="tab" aria-controls="profile" aria-selected="false">
									查看详情
								</button>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
		<!-- </div> -->
		<!-- </div> -->
		<script src="../../../lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
		<script src="../../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
		<script src="../../../js/lay-config.js?v=1.0.4" charset="utf-8"></script>
		<script src="../../../lib/jq-module/jquery.particleground.min.js" charset="utf-8"></script>
		<script src="../../../lib/common/jquery.cookie.min.js" charset="utf-8"></script>
		<script src="../../../lib/common/common.js" charset="utf-8"></script>
		<script src="../../../js/vue/vuejs-2.5.16.js" charset="utf-8"></script>
		<script src="../../../js/vue/vue-selected.js" charset="utf-8"></script>
		<script src="../../../js/vue/axios-0.18.0.js" charset="utf-8"></script>
		<script type="text/javascript">
			Vue.component('v-select', VueSelect.VueSelect);
			new Vue({
				el: '#yby',
				data: {
					processOptions: [],
				},
				methods: {
					loadProcessOptions: function() {
						var _this = this
						console.log(token)
						axios.get(api + "ProcessMaterialDesign/loadProcesses?checkTag=S001-2",{
								headers: {
									'TOKEN': token
								}
							})
							.then(function(response) {
								// alert("Sdsdsd")
								_this.processOptions = response.data.data;
							}).catch(function(reason) {
								console.log(reason);
							})
					}
				},
				mounted() {
					this.loadProcessOptions()
				}
			})
		</script>
		<script>
			layui.use(['form', 'table', 'laydate', 'layer', 'upload'], function() {
				var form = layui.form;
				var table = layui.table;
				var laydate = layui.laydate;
				var layer = layui.layer;
				var upload = layui.upload;
				// 物料编号生成
				let id = generatingNumberingRules("201", 4)
				console.log(id)


				// 加载数据表格
				// /api/ProcessMaterialDesign/loadProcesses
				var tableIns = table.render({
					elem: '#goodsTable',
					url: api + 'ProcessMaterialDesign/loadProcesses?checkTag=S001-2',
					// toolbar: "#goodsToolBar",
					cellMinWidth: true,
					height: 'full-220',
					cols: [
						[{
								type: "checkbox",
								fixed: "left"
							},
							{
								field: 'designId',
								title: '工序设计单编号',
								align: "center"
							},
							{
								field: 'productId',
								title: '产品编号',
								align: "center"
							},
							{
								field: 'productName',
								title: '产品名称',
								align: "center"
							}, {
								field: 'designer',
								title: '设计人',
								align: "center"
							},
							{
								field: 'register',
								title: '登记人',
								align: "center"
							},
							{
								field: 'registerTime',
								title: '登记时间',
								align: "center"
							},
							// designModuleTag


							/* 
							 	<span v-show="item.designModuleTag=='G002-1'">未设计</span>
							 										<span v-show="item.designModuleTag=='G002-2'">未审核</span>
							 										<span v-show="item.designModuleTag=='G002-3'">已审核</span>
							 */
							{
								field: 'designModuleTag',
								title: '工序物料设计标志',
								align: "center",
								templet: function(d) {
									if (d.designModuleTag === 'G002-1') {
										return "未设计";
									} else if (d.designModuleTag === 'G002-2') {
										return "未审核";
									} else {
										return "已审核";
									}
								}
							},
							{
								field: 'costPriceSum',
								title: '工时总成本',
								align: "center"
							},

							{
								title: '操作',
								templet: '#goodsTableBar',
								fixed: "right",
								align: "center",
								width: 180
							}
						]
					],
					page: true
				});

				// 监听搜索操作
				form.on('submit(data-search-btn)', function(data) {
					var params = $("#searchFrm").serialize();
					//执行搜索重载
					table.reload('goodsTable', {
						page: {
							curr: 1
						},
						url: api + 'ProcessMaterialDesign/loadProcesses?' + params + "&checkTag=S001-2"
					});
					return false;
				});





				//监听行数据的事件
				table.on('tool(goodsTable)', function(obj) {
					var data = obj.data;
					console.log(obj.event)
					if (obj.event === 'delete') {
						layer.prompt({
							formType: 1,
							value: '',
							maxlength: 6, //可输入文本的最大长度，默认500
							title: '敏感操作，请输入口令'
						}, function(value, index, elem) {
							if (value == 'yby123') {
								$.post(api + "goods/deleteGoods", {
									id: data.id
								}, function(res) {
									layer.msg(res.msg);
									obj.del();
									layer.close(index);
								})
							} else {
								layer.msg("口令错误");
							}
						});
						// design
					}

				});




			});
		</script>

		<!-- <script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js" type="text/javascript" charset="utf-8"></script>
	 
	<script src="https://raw.githack.com/hnzzmsf/layui-formSelects/master/dist/formSelects-v4.min.js" type="text/javascript" charset="utf-8"></script>
	 
	<script type="text/javascript">
	    //加载模块
	    layui.use(['jquery', 'formSelects'], function () {
	        var formSelects = layui.formSelects;
	   });
	</script> -->

	</body>

</html>
